import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';

@Entity('sys_menu')
export class SysMenu {
  @PrimaryGeneratedColumn({ type: 'bigint', comment: 'ID' })
  id: number;

  @Column({ type: 'bigint', comment: '父菜单ID' })
  parent_id: number;

  @Column({ type: 'varchar', length: 255, nullable: true, comment: '父节点ID路径' })
  tree_path: string;

  @Column({ type: 'varchar', length: 64, comment: '菜单名称' })
  name: string;

  @Column({ type: 'tinyint', comment: '菜单类型（1-菜单 2-目录 3-外链 4-按钮）' })
  type: number;

  @Column({ type: 'varchar', length: 255, nullable: true, comment: '路由名称' })
  route_name: string;

  @Column({ type: 'varchar', length: 128, nullable: true, comment: '路由路径' })
  route_path: string;

  @Column({ type: 'varchar', length: 128, nullable: true, comment: '组件路径' })
  component: string;

  @Column({ type: 'varchar', length: 128, nullable: true, comment: '权限标识' })
  perm: string;

  @Column({ type: 'tinyint', default: 0, nullable: true, comment: '是否始终显示' })
  always_show: number;

  @Column({ type: 'tinyint', default: 0,  nullable: true, comment: '是否开启页面缓存' })
  keep_alive: number;

  @Column({ type: 'boolean', default: true, comment: '显示状态' })
  visible: boolean;

  @Column({ type: 'int', default: 0, comment: '排序' })
  sort: number;

  @Column({ type: 'varchar', length: 64, nullable: true, comment: '菜单图标' })
  icon: string;

  @Column({ type: 'varchar', length: 128, nullable: true, comment: '跳转路径' })
  redirect: string;

  @Column({ type: 'datetime', nullable: true, comment: '创建时间' })
  create_time: Date;

  @Column({ type: 'datetime', nullable: true, comment: '更新时间' })
  update_time: Date;

  @Column({ type: 'varchar', length: 255, nullable: true, comment: '路由参数' })
  params: string;
}
